home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 13417B4 (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  1.9 KB  |  41 lines

  1. package com.sun.java.swing.plaf.metal;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Graphics;
  6.  
  7. class MetalIconFactory$InternalFrameCloseIcon extends MetalIconFactory.InternalFrameMaximizeIcon {
  8.    Color slashColor;
  9.  
  10.    public MetalIconFactory$InternalFrameCloseIcon(int size) {
  11.       super(size);
  12.    }
  13.  
  14.    public void paintIcon(Component c, Graphics g, int x, int y) {
  15.       super.paintIcon(c, g, x, y);
  16.       this.slashColor = MetalLookAndFeel.getPrimaryControlDarkShadow();
  17.       if (super.parentButton.getClientProperty("paintActive") != Boolean.TRUE) {
  18.          this.slashColor = MetalLookAndFeel.getControlDarkShadow();
  19.       } else if (super.buttonModel.isPressed() && super.buttonModel.isArmed()) {
  20.          this.slashColor = MetalLookAndFeel.getPrimaryControlInfo();
  21.       }
  22.  
  23.       g.translate(x, y);
  24.       g.setColor(this.slashColor);
  25.  
  26.       for(int i = 2; super.iconSize >= i + 4; ++i) {
  27.          g.fillRect(i, super.iconSize - i - 2, 2, 2);
  28.       }
  29.  
  30.       g.translate(-x, -y);
  31.    }
  32.  
  33.    public int getIconWidth() {
  34.       return super.iconSize;
  35.    }
  36.  
  37.    public int getIconHeight() {
  38.       return super.iconSize;
  39.    }
  40. }
  41.